﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VOL;
using BLL;
using System.Data;

namespace Web
{
    public partial class Detail : System.Web.UI.Page
    {
        DMHangBL _DMHangBL = new DMHangBL();
        protected void Page_Load(object sender, EventArgs e)
        {
            int _MaHang = 0;
            if (Request.QueryString["MaHang"] != null)
            {
                int.TryParse(Request.QueryString["MaHang"], out _MaHang);
            }

            if (_MaHang > 0)
            {
                DataTable dt = _DMHangBL.Detail(_MaHang);
                lblTenHang.Text = dt.Rows[0]["TenHang"].ToString();
                lblDonViTinh.Text = dt.Rows[0]["DVT"].ToString();
                lblMota.Text = dt.Rows[0]["MoTa"].ToString();
                lblDonGia.Text = dt.Rows[0]["DonGia"].ToString();
                Image1.ImageUrl = dt.Rows[0]["HinhAnh"].ToString();
                hlkNhaCungCap.NavigateUrl = "~/Products.aspx?MaNhaCungCap=" + dt.Rows[0]["MaNhaCungCap"].ToString();
                hlkNhaCungCap.Text = dt.Rows[0]["TenNhaCungCap"].ToString();
                hlkLoaiHang.NavigateUrl = "~/Products.aspx?MaLoaiHang=" + dt.Rows[0]["MaLoaiHang"].ToString();
                hlkLoaiHang.Text = dt.Rows[0]["TenLoaiHang"].ToString();
                hlkCart.NavigateUrl = "~/Cart.aspx?MaHang=" + dt.Rows[0]["MaHang"].ToString();
            }
        }
    }
}